import pickle
d =  dict(name = 'Bob',age = 20,score = 88)
print(pickle.dumps(d))
# 将序列化的bytes内容保存到文件中：
fp = open('pickle.data', 'wb')
pickle.dump(d, fp)


print("------------------------------")
#反序列化
fp = open('pickle.data', 'rb')
print(pickle.load(fp))

